package cn.tedu.spring.dibase;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class UserDao {
    @Value("jdbc:mysql://localhost:3306/tetu")
    private String url;

    @Value("root")
    private String username;

    @Value("199700")
    private String password;

    public String getUrl() {
        return url;
    }

    /**
     * 这里面是通过set方法注入的，也可以使用@Value注解注入
     * @param url
     */
    public void setUrl(String url) {
        this.url = url;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "UserDao{" +
                "url='" + url + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
